See mat2cell() to divide the array into cells. Start by letting the CurrentImage be the original image. Then repeat
T = CurrentImage;
T(end-mod(size(T,1),16)+1:end, :) = ;
T(:, end-mod(size(T,2),16)+1:end) = ;
now break out of loop if T is empty
Now you can mat2cell to extract 16 x 16 blocks. Store them. Then,
CurrentImage = CurrentImage(2:end,2:end);
and start loop over again. You would be extracting the blocks one over and one down from the first set of blocks. Next iteration you would be going with one over and one down from that, and so on.