Only half of gui.rect can detect mouseposition

void Update()
{
if (Input.GetMouseButtonDown(0))
{
mouseDown = true;
}
}

void OnGUI()
{
            GUI.BeginGroup(new Rect(0, Screen.height-(Screen.height*0.2f), Screen.width, Screen.height));
    		GUI.Box(new Rect(0, 0, Screen.width, Screen.height), guiTex);
    
    		Rect r1 = new Rect (0, 0, 100, 100);
    		GUI.Button(r1, "1");
    
    		if (mouseDown == true && r1.Contains(Input.mousePosition))
    		{
    			if (player.shape == 1)
    			{
    				player.UseAbility();
    			}
    			else
    			{
    				player.SwitchShape(1);
    			}
    		}
}

Can anyone explain to me why the button only works when I click the “lower-half” of it?

Input.mousePosition is in Screen coordinates that start in the lower left of the screen, but GUI uses GUI coordinates that start in the upper left. To fix use GUI Events:

 r1.Contains(Event.current.mousePosition)