Integrating a constant gives you a linear relationship: ie integrating a constant k (dx) results in kx (+constant of integration). A square wave is just two constant levels (eg +1, -1). So, that results in the triangle wave.
integration is finding how the area under a curve varies with time. So with a square wave in the first little time interval (t), you have V X t Voltseconds which has some value. now at the end of the next time interval you have another V X t. So for every t, you clock up an extra (V X t) volt seconds, so you have a relationship where the voltage at time T, is V X (T/t) which is similar to Y = mX where m is the slope (T/t).
Frank