title: Algorithm to take the union of rectangles and to see if the union is still a rectangle
body: <p>I have a problem in which I have to test whether the union of given set of rectangles forms
  a rectangle or not. I don't have much experience solving computational geometry problems.
  What my approach to the problem was that since I know the coordinates of all the rectangles, I can easily sort the points and then deduce the corner points of the largest rectangle possible. Then I could sweep a line and see if all the points on the line falls inside the rectangle. But, this approach is flawed and this would fail because the union may be in the form of a 'U'.
  I would be a great help if you could push me in the right direction.</p>