title: Rectangle Rotation and Flipping
body: <p>I have a bitmap with a Rectangle object that is drawn on top of it.  I want to be able to RotateFlip the bitmap and adjust the x, y, width, and height of the Rectangle so that it lines up with the bitmap after each rotation or flip.</p>
  
  <p>For example, if I have a bitmap of 1000 x 800 pixels, I may have a Rectangle object being drawn on it with a specified point and size.</p>
  
  <p>Sample code:</p>
  
  <pre><code>// A bitmap that's 1000x800 size
  Bitmap bitmap = new Bitmap(fileName); 
  
  // Any arbitrary rectangle that can be drawn inside the bitmap boundaries
  Rectangle rect = new Rectangle(200, 200, 100, 100);
  
  bitmap.RotateFlip(rotateFlipType);
  
  switch (rotateFlipType)
  {
      case Rotate90FlipNone:
          // Adjust rectangle to match new bitmap orientation
          rect = new Rectangle(?, ?, ?, ?);
          break;
      case RotateNoneFlip180:
          rect = new Rectangle(?, ?, ?, ?);
          break;
      // ... etc.
  }
  </code></pre>