Have texture2d follow 3d object

I’m trying to get a 2d texture to follow the x,y coordinates of a 3d object that’s moving in x,y,z in front of the players camera that also moves.

Purpose: I have a FPS space game. Distant objects quickly become hard to see. I would like a 2d visual representation of distant objects. Here is an example of what I’m trying to achieve in eve-online. Boxes and icons on the players screen that shows where objects are far off in space.

The code below works fine for the x axis, but when the player camera goes up/down, the icon moves with the camera away from the object it should be focused on.

public Transform target;
    public Texture2D icon1;

	void OnGUI()
		//Get player camera position
		Vector3 screenPos = Camera.main.WorldToScreenPoint(target.position);
		Rect rect = new Rect(screenPos.x - icon1.width / 2, screenPos.y * 2 - (icon1.height / 2), icon1.width, icon1.height);
		GUI.Label(rect, icon1);
		print("target is located at X:" + screenPos.x + " | Y:" + screenPos.y);

You’re mixing up GUI coords and screen coords. Screen coords are bottom-up, and GUI coords are top-down. You’d probably be better off using GUITexture objects, which use viewport coords (so use WorldToViewportPoint instead), but if you need to use OnGUI then invert the Y coordinate.