I don't see why not as long as you have your reciept.
You can normally exchange or return unused items to Home Depot with a receipt. If you don't have the receipt then they give you a card with store credit for the purchase price.
The carpet was cut off a roll for your length you needed, to them once it leaves the building it is a raiment which means it is discounted. I dont believe they will take it back unless you possibly exchange it and they are nice to you. Cut carpet is like a special order item and returns may not apply.
As long as the rug has not been cut off of a roll of carpet, and there is not any damage to the rug, you can. If you do not have a receipt, and you paid by credit/debit card or check they can look up your receipt. If you paid by cash they will give you a store credit. I worked as a head cashier for 2 1/2 years and now work in the paint department, so I know they will.