title: Shortest distance to rectangle caching
body: <p>I have a list of rectangles that don't have to be parallel to the axes. I also have a master rectangle that is parallel to the axes.<br>
  I need an algorithm that can tell which rectangle is a point closest to(the point must be in the master rectangle). the list of rectangles and master rectangle won't change during the algorithm and will be called with many points so some data structure should be created to make the lookup faster.<br>
  To be clear: distance from a rectangle to a point is the distance between the closest point in the rectangle to the point.<br>
  What algorithm/data structure can be used for this? memory is on higher priority on this, n log n is ok but n^2 is not.</p>