Extract patches from image

I believe this is a classic use case where Tensor.unfold can be used: