GUI.matrix causes GUILayout hover bounds to be incorrect

Since I stepped up to Unity 4.1.2f1, I’ve noticed that when I scale the GUI using GUI.matrix, GUILayout buttons don’t hover correctly when the cursor is over them unless I’m at the actual resolution to which I’m scaling the GUI.

It’s like the rect for the button isn’t being calculated correctly with the matrix applied, so the hover effect happens when the cursor is at a location slightly offset from the visible bounds of the button.

Here’s the code where I apply the matrix to the GUI:

public const float ScreenWidth = 800;
public const float ScreenHeight = 600;	

void OnGUI()
{
	Vector3 scale = new Vector3((float)Screen.width / ScreenWidth, (float)Screen.height / ScreenHeight, 1);
	GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale);

	// Draw gui stuff here
}

Is this a bug? Or am I doing something wrong?

Seems to be hover logic is brocken from 4.1.2.

I found out if you call GUI.Window() from OnGUI(), breaks up all that was her call.

Helped next hack:

void OnGUI()

{

    		GUI.skin = skin;
    		GUI.matrix = guiMatrix;
                //hack:
    		if(Event.current.type == EventType.Layout && Event.current.clickCount == 0) 
    			GUI.matrix = Matrix4x4.identity;
    
    		GUI.Window(0, rect, OnWindow, GUIContent.none, windowStyle);
    	}