One rectangle can be divided into two rectangles by drawing either a horizontal or a vertical line. Divide one of those rectangles and the result is three rectangles. Continue until you have N rectangles. Some limitations to observe to improve the results
- Don't divide a rectangle with a horizontal line if the height is below some threshold
- Don't divide a rectangle with a vertical line if the width is below some threshold
- Divide by quarters, thirds, or halves, i.e. avoid 90/10 splits
- Keep a list of rectangles sorted by area, and always divide the rectangle with the largest area