From imperial splendour to defiant protest, St Petersburg's art reveals centuries of ambition, authority and resistance.