I have many horizontal and vertical lines that make up a rectangle, for example, in this example.

Is there an algorithm or code that can find every rectangle that does not contain another rectangle. I mean, the largest rectangle in this image is not the rectangle I'm looking for, because it contains other rectangles inside it.
The rectangles I'm looking for should be empty. I have a list of start and end points of each line, for example (a, b) - (c, d). As a result, I want to get a list of rectangles (x, y, w, h) or equivalent.
, , , , , , .