Moving Camera Help

I have an image that is the size of the iphone screen, 480x320. I have a camera that is zoomed in to 1/4 of the image size. What I need is to be able to swipe with my finger, the screen, and the camera moves around the image. The key thing is the camera cannot leave the image. So if I scroll all the way to the left, the furthest it must show is the left end of the image and the top end. So how do I use iphone input to swipe and move the camera, and how do I keep the camera from moving beyond where I need it to go?

Do you need to show other objects in the scene? If you are just viewing the image by itself, you might find it easier to use the GUI system to handle the scrolling image. You can display a texture that extends beyond the edges of the screen with GUI.DrawTexture. You just need to specify negative origin coordinates and width/height values larger than the screen. The code will probably look something like the following:-

var pic: Texture2D;

private var maxX: float;
private var maxY: float;
private var scrollX: float;
private var scrollY: float;


function Start() {
	maxX = pic.width * 4 - Screen.width;
	maxY = pic.height * 4 - Screen.height;
}


function Update() {
	if (Input.GetMouseButton(0)) {
		scrollX = Mathf.Clamp(scrollX + Input.GetAxis("Mouse X"), -maxX, 0);
		scrollY = Mathf.Clamp(scrollY - Input.GetAxis("Mouse Y"), -maxY, 0);
	}
}


function OnGUI() {
	GUI.DrawTexture(Rect(scrollX, scrollY, Screen.width * 4, Screen.height * 4), pic);
}