Image bounds miscalculated?

So I’m trying to detect if the player is dragging his mouse over a transparent sprite and I noticed weird behavior, so I used a DrawLine to see the bounds of the box and I’m getting weird results that don’t make sense.
I made certain that every piece is the correct one and I checked that the piecePos and pieceBounds make sense. Yet when I run the code, this happens
The red lines should be going from corner to corner of their respective boxes, and yet it isn’t even halfway there, it’s a little more than halfway there. I account for the scale of the parent object named slidingLockPieces. Any ideas what’s happening? I tried to not account for the scale, but that made it too big.

` GameObject piece = pieces[numPiecesSwiped]; //get the next piece and its data Vector3 piecePos = piece.transform.position; Vector3 pieceBounds = piece.GetComponent().sizeDelta / 2 * slidingLockPieces.transform.localScale.x; Debug.DrawLine(piecePos - pieceBounds, piecePos + pieceBounds,, 3.0f); `

Figured it out. The reason for the miscalculation is because the canvas was set to Scale with screen size. The solution is to account for the scaling

`CanvasScaler canvasScaler = canvas.GetComponent(); float screenAdjust = Screen.height / canvas.referenceResolution.y; piece.transform.position; Vector3 pieceBounds = piece.GetComponent().sizeDelta / 2 * slidingLockPieces.transform.localScale.x * screenAdjust;`