Not exactly. If there are no counter resets, then it's
(last value in time window - first value in time window) / (timestamp of last value - timestamp of first value)
Consider a 5 minute window with 1 minute scrape intervals. You are likely to have 5 values within the window, and there is 4 minutes between the first and last.
<--------- 5 mins -------->
| X X X X X |
<------ 4 mins ----->
So the rate is calculated over the 4 minute period between the first and last X.
Counter resets make it more complex than that; only the periods where the value is not decreasing are considered.