Roation toward borders if array

HI, I need to rotate components toward borders of rectangle
like on a picture