The geometry of SDP-exactness in quadratic optimization