title: Implement drag and drop with mouse in Monogame
body: <p>I'm trying to implement some windows in my test app, and now I'm trying to make these windows able to be dragged.</p>
  
  <p>Check that awesome illustration to see what I'm trying to do, and what actually happens:
  <a href="https://i.stack.imgur.com/kRG2V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kRG2V.png" alt="enter image description here"></a></p>
  
  <p>First, I check if the mouse position is on top of the window and if the left mouse button is pressed and held, here:</p>
  
  <pre><code>if (mouseOver &amp;&amp; LastLeftPressed &amp;&amp; MouseLeftPressed)
  {
       onHoldClick(Events);
  }
  </code></pre>
  
  <p>This is what I've tried:</p>
  
  <pre><code>private static void onHold(object sender, EventArgs e)
  {
      var LastMouse = mousePosition;
      mousePosition = Mouse.GetState().Position;
      var window = sender as Window;
      if (LastMouse != mousePosition)
      {
          var deltaX = mousePosition.X - LastMouse.X;
          var deltaY = mousePosition.Y - LastMouse.Y;
          window.Rectangle = new Rectangle(mousePosition.X - deltaX, mousePosition.Y - deltaY, Width, Height);
      }
  }
  </code></pre>
  
  <p>Sometimes the results are really weird, such as the window jumps to random positions, but usually the results are as the illustration above. When I click'n'hold and move the mouse really slowly, the window will be instantly moved to the mouse's position.</p>
  
  <p>I can't figure this out.</p>