I am looking for an algorithm which can split an image into smaller images, with some constraints. One constraint is to use the least amount of \"whitespace\" meaning empty
I would look at doing it recursively, each time splitting in half or into four, until you get to the level you want (for you 2 -> 4^2 = 16). At the bottom level check for empty squares and discard them. Of course this gives you a grid of rectangles proportional to the shape of the original image, rather than optimally placed rectangles, but it might start you off on the right track.