This paper develops the optimal linear transformation (or precoding) of orthogonal space-time block codes (STBC) for minimizing probability of decoding error, when the channel covariance matrix is available at the transmitter. We build on recent work that stated the performance criterion without solving for the transformation. In this paper, we provide a water-filling solution for multi-input single-output (MISO) systems, and present a numerical solution for multi-input multi-output (MIMO) systems. Our results confirm that eigen-beamforming is optimal at low SNR or highly correlated channels, and full diversity is optimal at high SNR or weakly correlated channels, in terms of error probability. This conclusion is similar to one reached recently from the capacity-achieving viewpoint.