Sure if you drop it compare it against Screenbounds and if its outside you move it into Screenspace again. Doing this On Mouse move works too but is a bit Harder to setup. The Calculations themself are a bit tricky too since you have to take Anchor points, Scale and DPI and potantialy other Factors into consideration. Work your way up step by step and check your Numbers often if the match up with what you expect. Also change your Screensize often so you see DPI changes too.
Good Luck mate =)