Spain defender Gerard Pique has revealed that he will retire from international football following the 2018 World Cup after growing "tired" of criticism.