title: Why UI Element corners are equal to Canvas corners?
body: <p>I'm building a game in Unity for Android in portrait mode. I have a Canvas as big as the display and the render mode is set to Screen Space - Camera. I also have a RawImage (child of the Canvas) colored in blue that I resized and repositioned in code to fit my needs. The problem came when I had to get the corners of the RawImage using the <a href="https://docs.unity3d.com/ScriptReference/RectTransform.GetWorldCorners.html" rel="nofollow noreferrer">GetWorldCorners</a> property of RectTransform. There was something wrong with the results and I finally found the problem, which is that even though the RawImage was resized and repositioned, the corners of the RawImage were the same as the corners of the Canvas. Look at the image below:
  <a href="https://i.stack.imgur.com/YKRQ9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YKRQ9.png" alt="enter image description here" /></a>
  I selected the RawImage from the Hierarchy and currently, the corners of the RawImage are the ones pointed by the RED Arrows. But I need the corners to be the ones pointed by the GREEN Arrows.</p>
  <p>Here is a simplified version of the resizing and repositioning function:</p>
  <pre><code>private void applyResize()
  {
      //The values of the Vector2s are the output, in the real function there is a formula that isn't relevant to this question
      myRawImage.GetComponent&lt;RectTransform&gt;().sizeDelta = new Vector2(864, 864);
      myRawImage.GetComponent&lt;RectTransform&gt;().anchoredPosition = new Vector2(0, -1178);
  }
  </code></pre>
  <p>I am sure that the problem comes from the 2 lines of code in the above function since you can see in the image that even the Pivot has not changed. I need to find a way to adapt the corners to the repositioned and resized RawImage, not before it was modified. I can provide any additional information if needed. I will greatly appreciate any amount of help. Thank you in advance!</p>
  <p><strong>UPDATE 1:</strong>
  The values of the offset position and the side are NOT fixed, they are calculated based on some of my parameters and based on the display size. The problem is not the values, they are right. As you can see, VISUALLY the RawImage has the right size(864x864) and it is in the right position on the Y axis (-1178). In the Inspector tab you can see that the RawImage is initially placed at the top and center side of the display. I modify it's position and size at Runtime. The problem is even though visually the RawImage is right, the anchors and pivot still remain the same as the Original, before calling the function. I need the corners of the RawImage to change based on the modified size and position. The goal here is to get the right corners of the RawImage because later on I need to draw a line containd within the RawImage so I need the right coordinates. I don't know any other way to approach this.</p>