title: Usage of InverseTransformPoint on rotated object
body: <p>I develop script for 2D grid that "lives" in 3D environment. The model of the grid is a two-dimensional array. The grid should be 
  modifiable - support for changing position, scale and rotation. One of the required functions is to get grid indexes (array[i, j]) 
  on mouse over. The script works OK while rotation is 0,0,0. There are no problems neither with moving nor with scaling, but if grid is rotated, then wrong indexes are returned. I use transform.InverseTransformPoint to convert world position of mouse to local coordinates on grid.</p>
  
  <p>The relevant part of the script:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class GridManager: MonoBehaviour {
  
      //...   
      public float    tileSize = 0.6f;    //tile size, tile width == tile hight
  
      private Object[, ] grid;
      private Vector3 gridBottomLeftLocal;
  
  
      void Start() {
          //...
          //grid start position is 0, y, 0
          gridBottomLeftLocal = new Vector3 (-gridSizeX / 2, transform.position.y, -gridSizeY / 2);
      }
  
      void Update() {
          Vector3 mousePos;
          if (getMousePosition(out mousePos)) {
              Debug.Log ("Hit");
              Vector2 tile = getTileByWorldPos(mousePos);
              Debug.Log ("Pos: " + tile);
          }
      }
  
      //TODO: check for out of grid bounds
      Vector2 getTileByWorldPos (Vector3 worldPos) {
          Vector3 localPos = transform.InverseTransformPoint(worldPos);
          Vector3 offset = localPos - gridBottomLeftLocal;
          int x = (offset.x % tileSize == 0) ? (int)(offset.x / tileSize) - 1: (int)(offset.x / tileSize);
          int y = (offset.z % tileSize == 0) ? (int)(offset.z / tileSize) - 1: (int)(offset.z / tileSize);
          return new Vector2 (x, y);
      }
  
      private bool getMousePosition(out Vector3 mousePos) {
          Vector3 a = transform.position + Vector3.forward;
          Vector3 b = transform.position + Vector3.right;
          Vector3 c = transform.position + new Vector3 (1,0,1);
          Plane plane = new Plane (a, b, c);
          Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
          float enter;
          bool isHit = plane.Raycast (ray, out enter);
          mousePos = isHit ? ray.GetPoint (enter) : Vector3.zero;
          return isHit;
      }
  
  }
  </code></pre>