AGB stars in the Magellanic Clouds. III. The rate of star formation across the Small Magellanic Cloud