A square-shaped heat flux cloak and a square-shaped heat flux concentrator have been designed theoretically according to the invariance symmetry of steady state thermal conductive equation. The direction of heat flux in these devices can be modulated as desired. Using the method of coordinate transformation, the inhomogeneous and anisotropic thermal conductivity in the transformation region have been acquired. Two-dimensional finite element simulations were performed to confirm the theoretical results.