In the recent landmark paper of Zheng and Tse it is shown for the quasi-static, Rayleigh-fading MIMO channel with n(t) transmit and n(r) receive antennas, that there exists a fundamental tradeoff between diversity gain and multiplexing gain, referred to as the Diversity-Multiplexing Gain (D-MG) tradeoff. This paper presents the first explicit construction of spacetime (ST) codes for an arbitrary number of transmit and/or receive antennas that achieve the D-MG tradeoff. It is shown here that ST codes constructed from cyclic-division-algebras (CDA) and satisfying a certain non-vanishing determinant (NVD) property, are optimal under the D-MG tradeoff for any n(t), n(r). Furthermore, this optimality is achieved with minimum possible value of the delay or block-length parameter T = n(t). CDA-based ST codes with NVD have previously been constructed for restricted values of nt. A unified construction of D-MG optimal CDA-based ST codes with NVD is given here, for any number nt of transmit antennas. The CDA-based constructions are also extended to provide D-MG optimal codes for all T >= n(t), again for any number nt of transmit antennas. This extension thus presents rectangular D-MG optimal space-time codes that achieve the D-MG tradeoff. Taken together, the above constructions also extend the region of T for which the D-MG tradeoff is precisely known from T >= n(t) + n(r) - 1 to T >= n(t).