Rotate around Pivot.

A newbie here. What exactly am I trying to do is, rotate the cubes when I press the circle in the center. The first position of the cubes will be like in the figure one and when the circle is pressed then the cubes rotate with pivot point as the center of the circle. The cubes are just for informative purpose only, when the artist comes it will change to insects, that is why the ‘cube A’ in the second figure is lying down! (And also the cubes are individual there will be many other cubes and circles and also blank spaces in the grid ). Can any please guide me how to do this?
alt text

alt text

As the first step I’m just trying to rotate one cube and after completing 90degree I am trying to display it. And that is also not working, but here goes my code:-

var yflower:Texture2D;
var bflower:Texture2D;
var flowerRect:Rect = Rect(100, 100, 100, 100);
var pivotPoint:Vector2=Vector2(100, 100);
var rotAngle=0;
//var firstCycle:boolean=false;
//var pivotPoint2:Vector2=Vector2(220,220);
var flowerRect2:Rect = Rect(0, 300, 300, 100);

function OnGUI () 
{	
//	GUI.DrawTexture(flowerRect, yflower, ScaleMode.ScaleToFit,true, 0);
	if (rotAngle<90)
	{
		GUIUtility.RotateAroundPivot(rotAngle, pivotPoint);
		GUI.DrawTexture(flowerRect, yflower, ScaleMode.ScaleToFit,true, 0);
		rotAngle++;
	
	}
	else if(rotAngle>=90)
	{
		GUI.DrawTexture(flowerRect2, yflower, ScaleMode.ScaleToFit,true, 0);
		Debug.Log("bflower");
	}
}

Its rotating once and disappears. :-(!!

You can use this to check for click:

var rect = Rect (0, 0, 150, 150); // Rect around your circle
if (rect.Contains(Input.mousePosition))
   if(Input.GetMouseButtonDown(0))
     //Do something on left click

To rotate your texure, you can do this:

var matrixBackup = GUI.matrix; // U need to save your original matrix
GUIUtility.RotateAroundPivot(angle, pivot); // In your case, angle will lerp from 0 to 90
GUI.DrawTexture(rect, texture);
GUI.matrix = matrixBackup; // And restore it at the end