Rotation profile flattening and toroidal flow shear reversal due to the coupling of magnetic islands in tokamaks