Fix bug with uneven spritesheet layouts

The bottom row would have part of it split off if there were empty
spots for sprites (e.g., when it doesn't actually form a rectangle).