title: Snap to a rotating grid in c#
body: <p>I'm trying to made a thing where I can snap an object to a grid. Currently I have this code</p>
  <pre><code>float x = Mathf.Round(selected.position.x / gridScale) * gridScale;
  float y = Mathf.Round(selected.position.y / gridScale) * gridScale;
  Vector3 gridPos = new Vector3(x, y, 0);
  </code></pre>
  <p>but it doesn't work because the base of the grid rotates, which causes the snapped position to be offset. How do I make it so it can snap to the grid correctlty when it rotates?</p>