I need to write code (in HLSL) which will take an arbitrary point A in space, a plane normal, and a point P on that plane, and produce an angle representing the rotation (from the plane’s x axis, around the plane normal) the point P would need to make in order to face the projection of A on its plane.

If that seems like a mouthful, I’ve included a diagram:

In the above diagram, A is represented by a black cube, which is projected onto the XY, YZ, and XZ planes.

The use case is that the blades of grass need to be rotated around their local y axis in order to face the projected point. Performing the rotation is trivial but I can’t find a way to get the angle.