title: Checking if a point is inside a rotated rectangle
body: <p>I know this question has been asked a few times before, and I have read various posts about this. However I am struggling to get this to work. </p>
  
  <pre><code>    bool isClicked()
      {
          Vector2 origLoc = Location;
          Matrix rotationMatrix = Matrix.CreateRotationZ(-Rotation);
          Location = new Vector2(0 -(Texture.Width/2), 0 - (Texture.Height/2));
          Vector2 rotatedPoint = new Vector2(Game1.mouseState.X, Game1.mouseState.Y);
          rotatedPoint = Vector2.Transform(rotatedPoint, rotationMatrix);
  
          if (Game1.mouseState.LeftButton == ButtonState.Pressed &amp;&amp;
              rotatedPoint.X &gt; Location.X &amp;&amp;
              rotatedPoint.X &lt; Location.X + Texture.Width &amp;&amp;
              rotatedPoint.Y &gt; Location.Y &amp;&amp;
              rotatedPoint.Y &lt; Location.Y + Texture.Height)
          {
              Location = origLoc;
              return true;
          }
          Location = origLoc;
          return false;
      }
  </code></pre>