How to make minimap GUI stay put?

I am using C# scipt to use render texture and material. When I switch from 16:9 screen ratio to full screen on play, the GUI is in another location. How can I make it stay?

Would it be in the right place if I built the game in 16:9 and resized my screen?

Thank you!

note: even when dragging the screen to enlarge the scene view, the GUI gets out of place, while being in 16:9 the entire time.

Here is my script for minimap:

using UnityEngine;


public class minimapcee : MonoBehaviour {
	
	public RenderTexture MiniMapTexture;
	public Material MiniMapMaterial;
	
	private float offset;
	
	void Awake()
	{
		offset = 10;
	}
	
	void OnGUI()
	{
		if(Event.current.type == EventType.Repaint)
			Graphics.DrawTexture(new Rect(14, 278, 88, 88), MiniMapTexture, MiniMapMaterial);
	
	}
}

Try using this script:

public float screenWidth = 960;
public float screenHeight = 640;
Matrix4x4 tMatrix;
void Awake ()
{ RotateDevice();
}
void RotateDevice()
{ tMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity,
new Vector3((float)1.0 * Screen.width/screenWidth,
(float) 1.0 * Screen.height/screenHeight, 1.0f));
}
void OnGUI()
{ GUI.matrix = tMatrix;
if(Event.current.type == EventType.Repaint)
Graphics.DrawTexture(new Rect(14, 278, 88, 88), MiniMapTexture, MiniMapMaterial);
}

Set screenWidth and screenHeight to your 16:9 one, and the rest of the script will automatically resize and reposition your GUI based on the current screen size, so that it will always be in the “right” place.