This could at least limit the movement of the green location in world space, but to limit your mouse you could only limit it on your screen and if I remember right you wanted to move the camera around. So the player could just move to the right to get outside the world with the mouse, but in this way you can limit the green thing to the bounds you want. You may have to change the lower variable to a different one, but not a simple =. This would cause it to stop only if it touches exactly the limit line, not over or under it.
