calculate gradient for rectangles - started
calculate gradient for rectangles - started