Get offscreen gameobject nearest point of screen border

Hello, Im trying to reposition an offscreen GameObject (B) on its nearest screen border point (C). As you can see on this image. A is screen center point.

110946-d1.png

My first approach was to get the angle between A and the top center screen point (D on next image) in order to later calculate the angle between that and AB and finally get somehow C… But I cant even get started because Vector2.Angle returns the red angle shown on second image, and not a 90º as I would expected for AD…
110947-d2.png

Do you know a way to get the angles as I expected (and not from screen 0,0 point) or could you suggest me a different approach? Thanks.

use camera.WorldToVieportPoint (or what the name was) on the object. Clamp01 x and y. reverse the transformation.