Improve rectangle marking.