Drag and drop texture

Hi, im working on a script to grab a texture using mouse and move it throught the screen. I want to move different textures to order it.

I have:

void OnGUI() {

		if(cont<1)
		{
			rect= new Rect(rectx,recty,100,100);
		}
		GUI.DrawTexture(rect,Formula1);			
		if(rect.Contains(Event.current.mousePosition))
		{

			if(Event.current.type == EventType.MouseDrag)
			{

				Vector2 tempDelta = Event.current.delta;
				rectx=tempDelta.x +rectx;
				recty=tempDelta.y +recty;
				rect = new Rect(rectx,recty,100,100);
				cont=1;
				//transform.Translate (tempDelta*-0.05f);
			}
		}

	}

With this i can move the texture but always without moving out of the texture or it stops. How can i fix it?

Thanks

you can have a variable called "drag" and then make it true when you click on a texture and then move the texture to mouse position till a mouse up event occures.