A geometric Casselman-Shalika formula