Likely because you were using CalculateRelative. You were calculating the dimensions relative to 'this.transform', which already includes the localPosition offset as a part of it. You need to use the version of that function that has 2 parameters and pass the transform's parent as the 'root'.
The code snipplet you posted is quite odd in general. It sounds like you are not sure about the coordinate systems. To convert from local to world space, use transform.TransformPoint. To convert from world space to local space, use transform.InverseTransformPoint. To convert from screen to world, use camera.ScreenToWorldPoint, etc. Unity's documentation may explain this better.