How to get the rect of a GUI button ?

How do I get the Rect of a selected button in nested scale/rotate and GUIlayout?

Thanks.

GUIUtility.ScaleAroundPivot(new Vector2(currentPosRotScale.sx, currentPosRotScale.sy), pivot);      GUIUtility.RotateAroundPivot(currentPosRotScale.r, pivot);
GUILayout.BeginArea(viewRect);
{
    for (int i =0;i<number;i++)
    {
        GUILayout.Button("test " + i, GUILayout.Height(50), GUILayout.Width(50));
    }
}
GUILayout.EndArea();

Do you need the axis-aligned bounding rect or a representation of the rotated rect?

The bounding box would suffice