You will need to study the various functions available in the bios int 10h. You won't find any ready made functions to "drag and drop" (I don't think); you will just have to keep redrawing the rectangle as the mouse moves; each time saving the original screen contents so that they can be restored each time the mouse moves to a new location.