A Variational Perspective on the Assignment Flow