How to Extract 3d patches using unfold?

I’m not sure, if there is an easy way to create patches and reconstruct the input image without padding, if the shapes do not match.
Have a look at this post to see, how to use padding to reconstruct the input again.