Rate and diversity impose a fundamental tradeoff in wireless communication. We propose a novel distributed space-time coding (DSTC) scheme based on linear constellation precoding (LCP) for Amplify-and-Forward relaying networks. The proposed scheme can achieve full-diversity or full-rate, and also offers a flexibility for a desired rate-diversity tradeoff. This scheme works well with arbitrary signal constellation and any number of relays. Through performance analysis, coding design criteria and decoding strategy are provided. Simulation results show that the proposed coding scheme outperforms diagonal DSTC (DDSTC) and distributed linear dispersion (DLD) code at high power. From the comparison with DDSTC, the DSTC-LCP scheme achieves the same rate using a lower modulation order, yielding almost the same performance.