First, go to a point, at the center of the square, and set the command /worldborder center.
Next, set the command /worldborder set (number of blocks).
For example, if you want it to be 10000x10000, set the command /worldborder set 20000 (10000 positive and 10000 negative)