A script that reduces a grid of squares to simpler rectangles.