Get exact terrain height

I need to place a small rectangle on the terrain at runtime (cursor in a grid-based game). The terrain has hills n whatnot, so I need to know the height of the terrain at all four corners of the rectangle, otherwise its mesh gets hidden under the terrain.

I tried using Terrain.SampleHeight() to do this, but it’s very inaccurate and about half of the time, the reported height is lower then the actual terrain height. Do I need to raycast or is there a simpler way?

Well why don’t you raycast all 4 corners?

Then you get the exact point where the raycast hits the collider (RaycastHit.point.y I think)