title: How to scale a rotated rectangle to always fit another rectangle
body: <p>the background of my question is the following.
  I have a picture and a crop rectangle which describes how the picture should be cropped to produce the resulting picture. The crop rectangle is always smaller or at maximum the size of the picture.
  Now it should be possible to rotate the crop rectangle.
  This means that when rotating the crop regtanle inside the picture, the crop must be scaled in order that its extends does not exceed the photo.</p>
  
  <p>Can anybode help me with a formula of how to compute the scale of the crop rectanlge based on the axis aligned photo regtancle?</p>
  
  <p>My first attempt was to compute a axis aligned bounding box of the crop rectanlge and than make this fit it the photo rectangle. But somehow i get stuck with this approach,</p>
  
  <p><strong>Edited:</strong>
  One more think to note:
  - The crop rectangle can have other dimension and another center point inside the surrounding rectangle. This means the crop rectangle can be much smaller but for example is located at the lower left bound of the picture rectangle. So when rotating the smaller crop it will also exceed its limits</p>
  
  <p>Thanks in advance
  Sebastian</p>