Translate GetWorldCorners (new UI) to Viewport for a camera rect

I’m trying to assign a camera rect so it matches a CameraPanel while it’s dragged throught the screen. Currently I do something like this (Y axis should be inverted):

cameraContainer.GetWorldCorners (corners);

Rect r = new Rect (corners[0].x / Screen.width, corners[0].y / Screen.height, (corners[2].x - corners[0].x) / Screen.width, (corners[2].y - corners[0].y) / Screen.height);

camera.pixelRect = r;

What I get is that if I move the panel all to the left, the corner[0].x value is not 0 unless I move it to the left of the left edge. Is there something I’m missing?

Got a solution. I thought that canvas in screen space would match the camera, but no, so I had to use the canvas RectTransform corners to transform the camera container corners from canvas space to screen space, which is just a few substractions.