title: Find out an object's box actual 4 edges scaled to the screen/camera size (Unity 2D)
body: <p>I'm writing a function to figure out if a 2D object is completely inside another.
  I'm doing this by getting the object's position, then with this position and it's size, calculating the object's edges position, then doing a check with Camera.main.pixelRect.Contains. This is my current code:</p>
  
  <pre><code> // get the center of the object
   Vector2 pos = Camera.main.WorldToScreenPoint(card.transform.position);
  
   // get the bounding box
   var rect = image.transform.rect;
  
   var topLeft = new Vector2(pos.x - (rect.width / 2), pos.y - (rect.height / 2);
  
  
  return Camera.main.pixelRect.Contains(topLeft);
  </code></pre>
  
  <p>My problem is, being new to Unity, the measurements do not match. I'm confused on when the object is scaled with the screen size, I will get the actual width of the image and it calculates wrong.</p>
  
  <p>I also tested getting rect with: </p>
  
  <pre><code>rect = GetComponent&lt;RectTransform&gt;().rect;
  </code></pre>
  
  <p>Can someone help me out how to make this work?</p>
  
  <p>Ps: if there is a better way of checking when a 2D object is completely inside another, I would also accept that.</p>