You do checks to ensure top/left aren't under zero. Why not the same for width/height?