Generalized Total Least Squares