Quantum Thermal Rectification to Design Thermal Diodes and Transistors