Maximum sum rectangle in a 2D matrix

this is standarad problem in geek for geeks.i am unable to think dynamic approach.please help me.
i am understanding logic but unable to do by DP.