public static bool ScreenPointToWorldPointInRectangle(RectTransform rect, Vector2 screenPoint, Camera cam, out Vector3 worldPoint)
{
float num;
worldPoint = (Vector3) Vector2.zero;
Ray ray = ScreenPointToRay(cam, screenPoint);
Plane plane = new Plane((Vector3) (rect.rotation * Vector3.back), rect.position);
if (!plane.Raycast(ray, out num))
{
return false;
}
worldPoint = ray.GetPoint(num);
return true;
}